import { createApp } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist'

import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/assets/global.scss'

const app = createApp(App)

const pinia = createPinia()
pinia.use(piniaPluginPersist)
app.use(pinia)
app.use(router)
app.use(ElementPlus)

/* 全局注册组件 */
import Table from '@/components/Table.vue'
import Dialog from '@/components/Dialog.vue'
app.component('Table', Table)
app.component('Dialog', Dialog)

/* 自定义的工具 */
import Request from '@/utils/Request'
import Message from '@/utils/Message'
import Api from '@/utils/Api'
import Confirm from '@/utils/Confirm'
app.config.globalProperties.Request = Request
app.config.globalProperties.Message = Message
app.config.globalProperties.Api = Api
app.config.globalProperties.Confirm = Confirm

app.mount('#app')
